import 'dart:math';

import 'package:find_friend/const/const.dart';
import 'package:find_friend/pages/mine/mine_follow.dart' show MineFollowPage;
import 'package:flutter/material.dart';

class StarspacePage extends StatefulWidget {
  final Function() onTap;
  _StarspacePageState _state;
  StarspacePage({Key key, this.onTap}) : super(key: key);

  @override
  _StarspacePageState createState() => _state = _StarspacePageState();

  void refreshData() {
    _state._refreshData();
  }
}

class _StarspacePageState extends State<StarspacePage> {

  bool isshow = true;
  MineFollowPage followWidget;
  @override
  void initState() {
    super.initState();
    followWidget = MineFollowPage(notshowAppbar: true,);
  }
  void _refreshData() {
    followWidget.refreshData();
  }

  void _hidden() {
    if(widget.onTap != null) widget.onTap();
    Future.delayed(const Duration(milliseconds: 150)).then((value) => setState(() => isshow = false));
    Future.delayed(const Duration(milliseconds: 300)).then((value) => setState(() => isshow = true));
  }
  @override
  Widget build(BuildContext context) {
    final size = MediaQuery.of(context).size;
    return SafeArea(
      child: Container(
        height: size.height,
        child: Column(
          children: [
            SizedBox(height: 30,),
            InkWell(
              onTap: _hidden,
              child: Transform.rotate(
                angle: pi,
                child: Offstage(
                  offstage: !isshow,
                  child: Image.asset("assets/shanghua2.png", height: 30, width: size.width, color: Colors.white,)
                )
              ),
            ),
            Expanded(
              child: InkWell(
                onTap: _hidden,
                child: Container(
                  decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10))
                  ),
                  child: Column(
                    children: [
                      Padding(
                        padding: const EdgeInsets.symmetric(vertical: 14),
                        child: Text("星域", style: instanceTextStyle(17, APP_font_black),),
                      ),
                      Expanded(child: followWidget),
                    ],
                  )
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}